home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-12-26 | 67.6 KB | 1,290 lines | [TEXT/KAHL] |
- /* THE QUICK SKINNY ON 4PLUS...^1<I */
-
- 4Plus is an INIT designed to enhance the THINK C editor. It has been written to
- be compatible with THINK C 4.0, and has proven to work with the 4.0.1 and 4.0.2
- maintenance releases Symantec has subsequently made available.
-
- This document is a THINK C text file, hence, I'm assuming you're reading it
- using THINK C. I'll also be assuming that you have the INIT installed -
- obviously it's not necessary that you do but I'll be talking about the various
- features as if you did. It makes things easier for both of us.
-
- /* The Options Menu */
-
- Attached to the THINK C menu bar is a new menu titled ‘4Plus’, though I'll be
- referring to it here on in as the options menu. It should look something like
- this...
-
- Create Hierarchy
- Update Hierarchy
- Dispose Hierarchy
- -
- Trash Mark Keys
- Trash Mark Queue
- Trash Mark Stack
- Trash Scrap Stack
- Update "rsrc.h"
- Update "proj.π.rsrc"
- Version Territory…
- Preferences >
- Enable Tree Search
- Cascading Progeny
- Display Comment
- Color Hiliting
- Power Thumb
- Prompt Keystroke
- Meta-able Comments
- -
- Configure 4Plus…
- About 4Plus…
-
- You should rarely need to use this menu. It serves mainly as a dump for those
- odd features/settings that didn't seem to belong anywhere else. The only reason
- I'm bringing it up now is because I'll be refering to it often throughout this
- document and I don't want to have to break stride every time I do. I'll also be
- frequently referring to something I'm calling the configuration dialog - it can
- be invoked by selecting the ‘Configure 4Plus…’ item from the options menu.
-
- /* The Configuration Dialog */
-
- When you look at the configuration dialog you're pretty much looking at
- everything 4Plus can do. 4Plus functionality can be broken down into two
- groups, those commands accessed by menus and those accessed via the keyboard.
- The configuration dialog allows you to determine what event invokes what
- command. Let's start with the menus.
-
- /* Configuring The Menus */
-
- When you select the menus portion of the configuration dialog, you end up with a
- list that should look something like this...
-
- Headers cntl-cmd wInContent
- MacHeaders opt wInDrag
- Methods cntl-shift wInContent
- Methods, sorted shift wInDrag
- Ancestry cntl-opt-shift wInDrag
- Siblings cntl-cmd-shift wInDrag
- Progeny cntl-opt-cmd wInDrag
- Comments cntl-cmd-shift wInDrag
- Omnibus cntl wInContent
-
- The events associated with each menu are a combination of a modifier key
- combination and a WDEF partcode. The modifier key combinations can range across
- all possible permutations of the control, option, command, shift and caps lock
- keys. In the dialog, the different modifier keys are represented by icons
- instead of words shown above... the icons are similar to those used by
- MacroMaker. The partcode corresponds to the result returned by a WDEF when
- called with a wHit message. For example, by looking at the list, we can see
- that the headers menu can be invoked by depressing both the control and command
- key while clicking in a window's content region. For those unfamiliar with the
- window partcodes, here they are...
-
- wInGoAway a click inside of the close box.
- wInZoomIn a click inside of the zoom box.
- wInDrag a click inside of the title bar, but not in any of the above.
- wInGrow a click inside of the grow box.
- wInContent a click inside of the window, but not in any of the above.
- wNoHit a click outside of the window, and outside of the menu bar.
-
- To change the way a menu is invoked, you select the menu in the list, depress
- those modifier keys you want to use to invoke the menu, and click within the
- appropriate window part as displayed in the little picture of a desktop to the
- left of the list. Let's say that all of the sudden I want to change the way the
- headers menu is invoked. Instead of having to hold down the control and command
- keys while clicking in a window's content region, I want to just use the control
- key while clicking in the window's title bar. To do this, I select the headers
- menu entry in the list by clicking on it, I depress the control key and I click
- within the drag region of the windoid in the desktop picture to the left of the
- list. The list entry for the options menu should now look like this...
-
- Headers cntl wInDrag
-
- The ability to customize the modifier key combinations allows 4Plus to be used
- in conjunction with other INIT's that similarly abuse the modifier keys. It
- also allows users of non-ADB keyboards full access to all of the features
- without penalizing the ADB keyboard owners. Additionally, for the non-ADB
- owners, an option exists wherein the caps lock key can be recognized as a
- modifier key and subsequently used for a menu assignment. Selecting the Caps
- Lock check box will cause 4Plus to be caps lock sensitive, deselecting it causes
- 4Plus to ignore the caps lock key. The Caps Lock option can be used with ADB
- keyboards as well, though there's less of a need to do so.
-
- /* Configuring The Keyboard */
-
- When you select the keys portion of the configuration dialog, you end up with a
- list part of which should look something like this...
-
- ......
- Macro Record esc
- Repeat F15
- Stack Cut F2
- Stack Copy F3
- Stack Paste F4
- Stack Dump cntl F4
- ......
-
- Pretty much the same concept as with the menus, only now we're no longer
- interested in WDEF partcodes. Associated with each command is a keystroke,
- usually accompanied by one or more modifier keys. For instance, we can see
- above that the ‘Stack Dump’ command is invoked by pressing the control and F4
- keys, simultaneously. If we want to change it, we select the Stack Dump entry
- in the list by selecting it, then invoke the new key sequence. This should all
- be very straightforward.
-
- The keys portion of the configuration dialog lists all of the commands provided
- by 4Plus. There is, in addition, another section to the configuration dialog
- that allows you to list macros (and the like) that you have defined, and through
- which the macros may be reassigned to different key events in the same manner as
- commands are. We'll get to the guts of all of this later.
-
- /* More About The Configuration Dialog */
-
- Some points regarding the configuration dialog...
-
- When you assign an event to a command when that event is already assigned to
- another command, the command that was previously associated with the event
- becomes 'undefined' and the system will beep at you. Currently, this is the
- only way in which you can deassign a command. Whether this is useful or not
- depends on whether or not you want to disable any 4Plus commands.
-
- Menu and key assignments are saved to disk and restored for subsequent sessions.
-
- If, for whatever reason, you find yourself unable to call up the configuration
- dialog from within THINK C, you can call it up from the Finder by double
- clicking on the INIT itself with both the option and command keys depressed.
- There shouldn't be any need to do so, as the configuration dialog is always
- available from the options menu.
-
- Use some common sense when assigning events. As an example, a potential
- conflict exists with the 'opt wInContent' assignment. Remember that THINK C
- looks for option modified clicks within the content region of it's windows. If
- after changing assignments you notice that THINK C isn't working like it used
- to, chances are you've overridden a valuable THINK C feature with a 4Plus
- feature. Don't let this happen.
-
- You'll need to refer to configuration dialog often throughout the rest of this
- document to determine how to invoke the command being described. I've
- distributed 4Plus with a default set of key assignments that assumes you are
- using an extended ADB keyboard - if you're not, you're going to have to adjust
- some of the assignments so that they're accessible via the keyboard you are
- using.
-
- /* Menus In General */
-
- 4Plus menus require that the frontmost window be a text window and have a
- filename, i.e., the 4Plus menus will not work with untitled windows. Most of
- the menus require that the text window be either a source file (*.c) or a header
- file (*.h). Some of the menus require that the file must also have been added
- to the current project and successfully compiled - and that the project's
- reference to the file must be correct. A file reference is information about a
- source or header file that allows THINK C to quickly determine where the file is
- located on the disk - this information is kept within the project file.
- Generally, file references are always correct as THINK C will update this
- information when executing certain commands (Run, Make, etc.). If you should
- move the project and/or it's files from one directory to another, or some such
- similar operation, the file references will become invalid. As 4Plus makes
- extensive use of these file references, it is necessary that they be correct in
- order for some 4Plus features to function. If you are ever unable to invoke any
- of these menus, invoke THINK C's Make dialog, deselect the Quick Scan check box,
- click the Use Disk button and then the Make button.
-
- /* The Headers Menu */
-
- The headers menu is exactly what THINK C has been offering since day one. 4Plus
- doesn't change the menu or it's contents any - it just allows you to change how
- it's invoked. It can still be invoked via a click in the window's title bar
- with either the option or command keys depressed - provided you haven't
- overridden the combination with a 4Plus menu. That's the only reason the
- headers menu assignment is provided, to allow you to assign another menu in the
- option or command key modifier slot when the mouse is clicked in the title bar.
- Just in case you want to.
-
- BTW, if you depress the option or command keys while clicking in the title bar
- of the project window, you get a menu listing ALL headers included from ALL
- source files within the project. This is a THINK C feature, though one that I
- believe is undocumented.
-
- /* The MacHeaders Menu */
-
- The MacHeaders menu is to the headers menu what precompiled headers are to
- normal headers. Listed within the menu are the precompiled header files that
- have been included in the current source file. This will usually be MacHeaders,
- however, it will work for a precompiled header file that has been explicitly
- included as well (finally). Selecting a item from the menu will open the
- corresponding header file and display it within it's own window.
-
- There are two caveats to this feature... the precompiled header file must be
- precompiled while 4Plus is installed, and the source file from within which the
- precompiled header file is included must have been successfully compiled at some
- point. Please read the last sentence again. A good thing to do right now would
- be to re-precompile MacHeaders.c, as well as any other precompiled headers you
- use. And again, don't forget that the source file from which the MacHeaders
- menu is to be invoked from must be included in the current project and must have
- been successfully compiled using the precompiled header.
-
- /* The Methods Menu */
-
- The methods menu will display all of the methods, procedures and functions
- defined within a source file (from hereon in, when I say method, I'm implicitly
- referring to procedures and functions as well). The source file need not have
- been added to a project in order for the methods menu to work (it only needs to
- have a filename ending in '.c'). Selecting a method from the menu will scroll
- the window as appropriate to display the method, and hilight it's name. As an
- option, if the method is preceded by a comment, then the window will be scrolled
- so as to display the comment as well. This can be controlled via the options
- menu by selecting the ‘Display Comments’ item.
-
- In order to operate correctly, the source file should be reasonably free of
- syntax errors, in particular - brackets, comment delimiters, parentheses, single
- and double quotes should all be balanced correctly. If not, the methods menu
- will take note of the error and insert a ‘syntax error’ item in the menu.
- Choosing this item will scroll the window so as to display the line in which the
- imbalance was detected and place the insertion point at the line's beginning.
- Note that this isn't necessarily where the imbalance is to be remedied.
-
- I have tested the methods menu on all of the source files in the THINK Class
- Library as well as all of the winning entries in the Obfuscated C Contest from
- 1984 through 1988 inclusive. I even tested it on my code. It worked with all
- of the above, with the exception of a few of the Obfuscated C entries that
- insisted on using the preprocessor to redefine various delimiters. For example:
-
- #define IF if (
- #define THEN ){
- #define AND ;
- #define END ;}
-
- IF a != b THEN a = a + b AND b = 0 END
-
- IF this is your coding style THEN you will not want to use 4Plus END (or at
- least not the methods menu). In order to correctly parse this kind of
- construct, it would be necessary to pull in all of the source file's includes.
- It would also be necessary to actually look at every token that comes in as well
- as maintaining a greater sense of context as the file is parsed, all of which
- would slow things down to the point where it would be faster to just scroll
- through the document yourself. That it is this way is likely the reason why
- such a feature was never included within THINK C to begin with... consistency is
- surely of greater value than convenience.
-
- Just when I was feeling really good about the algorithm used to parse methods, I
- did this...
-
- int (*foo(int foobar))
- {
- /* obnoxious code */
- };
-
- 4Plus thinks this function is called ‘void’. ARRGH! This is a bug. If you
- can, use typedef's when you're anticipating the need for writing functions that
- return pointers to functions. That's what THINK C does (look at the declaration
- for signal). That's what typedef's are for. All this embarrassment could have
- been avoided had I done this instead...
-
- ProcPtr foo(int foobar)
- {
- /* clean, easy to maintain code */
- }
-
- The methods menu will display the methods in the order in which they are
- declared in the source file. The method in the source file that contains the
- insertion point (or the beginning of an extended selection) is deemed to be the
- currently selected method, and as such the corresponding item in the methods
- menu will be hilited when the methods menu is invoked.
-
- /* The Sorted Methods Menu */
-
- The methods menu has a companion, the sorted methods menu. This menu is
- identical to the methods menu except that the methods are sorted alphabetically
- when displayed in the menu. Sometimes this is nice.
-
- /* The Ancestry, Siblings & Progeny Menus */
-
- The ancestry, siblings and progeny menus are best treated as if they are one.
- They are of use only if you are using the object oriented extensions made
- available with THINK C 4.0. These menus may be invoked from any source file
- containing the method definitions for a class, or from any header file
- containing a class definition. The source file or header file from within which
- the menus are to be invoked should have been added to the project file.
-
- /* The Ancestry Menu */
-
- The ancestry menu will display all of the classes in the given class's ancestry,
- i.e., it will display the given class's superclass, followed by the superclass's
- superclass, and so on, until the root class for the given class is displayed.
-
- /* The Siblings Menu */
-
- The siblings menu will display all classes who share the same superclass as the
- given class.
-
- /* The Progeny Menu */
-
- The progeny menu will display all subclasses of the given class, and optionally
- will display all subclasses of the subclasses, and their subclasses, and so on,
- until there are no more subclasses (more on this later).
-
- /* How To Use These Menus */
-
- Selecting a class from any of the menus will in turn open the file corresponding
- to the class. If the menu was invoked from within a source file, the selected
- class's source file will open, if invoked from within a header file, the
- selected class's header file will open. For source files, if you continue to
- depress the modifier keys used to invoke the menu after making a selection,
- 4Plus will take note of the currently selected method (same definition as in the
- methods menu). Then when the selected class is opened, 4Plus will look to see
- if that method is defined within the selected class, and if it is, the method
- gets displayed in the same fashion as if you had used the methods menu to
- display it. If the selected class doesn't contain the method, 4Plus will still
- remember the selected method, thus allowing you to repeat the process. The
- selected method is remembered until you change the selection point in any
- document, either by clicking in a document, typing, doing a scrap operation,
- etc.
-
- Taken together and when properly understood and used, these menus can make for a
- most effective browsing utility. However, there are some things you have to
- keep in mind as you use them. 4Plus determines the class hierarchy for a
- project based on the class definitions in a project's header files. The header
- files that contain the class definitions need to be named after the source files
- that contain the method definitions for the class (i.e., CFoo.c and CFoo.h).
- This is in keeping with the style THINK C recommends for setting up classes, and
- is how the THINK Class Library is itself put together. Note that the file name
- doesn't necessarily have to begin with a 'C'.
-
- /* Establishing The Hierarchy */
-
- Additionally, 4Plus needs to scan through the project before any of the menus
- can be invoked. It needs to do this so as to establish a project's hierarchy,
- and it needs for you to tell it when to perform the scan. This is accomplished
- via the options menu using the ‘Create Hierarchy’, ‘Update Hierarchy’, and
- ‘Dispose Hierarchy’ commands.
-
- /* Create Hierarchy */
-
- The ‘Create Hierarchy’ command is basically a short cut, it just does a ‘Dispose
- Hierarchy’ followed by an ‘Update Hierarchy’.
-
- /* Update Hierarchy */
-
- ‘Update Hierarchy’ looks through the project file and examines each reference to
- a source file it encounters. If the source file is found to include a header
- file by the same name, then the class hierarchy that 4Plus maintains is examined
- to determine whether an entry already exists for this class. If not, the header
- file is scanned for a class definition. If a class definition is found, entries
- are made for the class and it's superclass (if there exists more than one class
- definition within a header file, only the first applies).
-
- /* Dispose Hierarchy */
-
- ‘Dispose Hierarchy’ does just that, it disposes all class entries for a project.
- Note that it disposes only the entries 4Plus maintains internally, NOT your
- source code or any of your header files or anything else of value.
-
- Generally, you'll invoke the ‘Create Hierarchy’ command when you first introduce
- 4Plus to a project. Thereafter, use ‘Update Hierarchy’ whenever you add
- classes. The only time you'll need to again invoke the ‘Create Hierarchy’
- command is when you either delete a class or change an existing classes'
- ancestry.
-
- If you're ever in doubt, just use ‘Create Hierarchy’. Parsing a project doesn't
- take all that long, and you'll be assured of a complete and accurate
- representation of the project's hierarchy.
-
- /* Possible Problems */
-
- Generally, you'll want the file references contained within the project to be
- correct when creating and using the hierarchy menus. If any of the menus fail
- to appear or seem to be missing classes, you probably need to update your
- project.
-
- There are instances when THINK C doesn't provide the kind of information 4Plus
- needs in order to establish the hierarchy. Specifically, if you are utilizing
- THINK C's #define _H_filename feature within your header files, AND you have
- taken to precompiling some or all of the header files containing class
- definitions, 4Plus will not be able to use the project file to determine whether
- or not a given source file has a header file with the same name and where that
- header file resides. It does no good to "re-include" a header file that has
- been precompiled within it's associated source file. The only solution in this
- case is to force 4Plus to go into HFS Cruise Mode™ and try to find the header
- file on it's own.
-
- /* The Enable Tree Search Command */
-
- Located within the options menu is an item entitled ‘Enable Tree Search’. When
- this item has a check next to it, 4Plus, when creating or updating the class
- hierarchy, will try to locate the header file utilizing information contained
- within the project file. If it cannot find the information it needs, 4Plus will
- resort to searching the project tree, and then the THINK C tree, for a header
- file it thinks it needs. Note that the project tree and the THINK C tree are
- searched in that order, and that 4Plus will omit directories whose names are
- surrounded with brackets (unless the name for the directory minus the brackets
- is the same as the name for the project) just like THINK C does it. If and when
- 4Plus finds the header file, all is well and things go back to normal.
-
- 4Plus uses the search trees in very much the same manner as THINK C, hence, the
- THINK C documentation regarding use of these trees applies to 4Plus as well.
- There is one difference however relating to the order in which the trees are
- searched. 4Plus will always search the project tree before the THINK C tree.
- This can cause problems if the header file 4Plus is looking for resides in both
- trees, and the version you want to use is in the THINK C tree. So beware.
-
- The bad news about this whole tree search business is that doing a ‘Create
- Hierarchy’ will take longer due to the added file IO overhead. If you find
- yourself having to enable the tree search for your project, you'll be sure to
- want to use the ‘Update Hierarchy’ command instead of the ‘Create Hierarchy’
- command whenever possible.
-
- The good news is that a source file containing the method definitions for a
- class need not be successfully compiled in order for it to be displayed in the
- hierarchy menus. It need only be added to the project. Depending on what stage
- you are in with a project and your coding style, this can be a truly good thing.
-
- /* Hierarchical Menu Anxiety */
-
- One last thing I want to touch on with regards to the hierarchy menus has to do
- with the progeny menu in particular. There's an item in the options menu called
- ‘Cascading Progeny’. It is initially unchecked. In this state, you will only
- be able to display those classes which are a direct subclass of a given class.
- Choose ‘Cascading Progeny’ places a check next to the item, and thus allows you
- to display subclasses of subclasses of subclasses and so on. There are a number
- of problems with this however.
-
- The first problem has to do with the fact that hierarchical menus can nest only
- five deep. Thus, subclasses of a subclass that's a subclass of the subclass
- whose class is a subclass of a given class's subclass won't be displayed. If
- that doesn't bother you, then so far so good.
-
- The second problem has to do with the fact that we can only have up to 256
- hierarchical and popup menus at any one time. This is made worse by THINK C and
- 4Plus having other popup menus and by using some of these precious ID's for
- their own non-hierarchical menus. This puts a hard limit on just how big a
- project can be, though when you think about it, this shouldn't be a problem for
- any but the most gigantic projects. If a project has more than, say, 230
- classes that have subclasses, then the results when using 4Plus to display a
- class's progeny will be incomplete. If you're project doesn't (Art Class has
- only 33), then there isn't any problem.
-
- The third (and last, I think) problem is purely aesthetic. When you select a
- subclass that itself has subclasses, you don't get that nice blinking effect as
- a visual confirmation that the item was chosen. Instead, the menu just
- disappears, immediately. I personally find this disconcerting, but you may not.
- This violates Apple's idea of how things should work, but sometimes it pays to
- break the rules.
-
- I know that there are those who think that hierarchical menus are easily the
- most abused user-interface element on the Mac and who will be howling and
- hooting as they play around with the progeny menu. I will agree that the use of
- hierarchical menus for the sake of using same is not a good thing, or that the
- use of hierarchical menus to shy away from putting together a real interface is
- not a good thing, but I have to disagree when it comes to using hierarchical
- menus to display something that is truly hierarchical in nature. The class
- hierarchy definitely qualifies in this regard, and furthermore, this is an INIT.
- This is not PageMaker. When you're looking to provide maximum functionality
- with the minimum of coding and the minimum of impact on your host application,
- hierarchical popup menus become an acceptable solution.
-
- /* The Comments Menu */
-
- This menu will simply display the C-style comments contained in a text file. If
- you are reading this using THINK C and you have 4Plus installed, you can see
- what I mean by depressing the option, command and shift keys while clicking in
- the window's title bar (unless you've changed the assignment). Selecting a
- comment from the menu in turn scrolls the window so as to display the comment,
- and the comment's text is highlighted.
-
- The menu will not attempt to display comments that span over multiple lines.
- Excess asterisks and any white space following and/or preceding the comment
- delimiters is stripped out (of the menu). The opening comment delimiter must
- either start a line of text, or be preceded by one or more tab characters. The
- tab characters can be used to create a hierarchical menu, as was done in this
- document - though if the number of tabs preceding a comment exceeds the number
- of tabs preceding the preceding comment by two or more the comment will not be
- displayed.
-
- Within the options menu there is an item titled “Meta-able Comments”. This
- controls whether how 4Plus creates the menu. When “Meta-able Comments” is
- active, 4Plus simply uses the Menu Manager's AppendMenu routine, which will take
- the comment text and look for any meta-characters that may reside within (I
- assume you know what a meta-character is). Deselecting the option causes 4Plus
- to use SetItem instead - hence, no meta-characters. You can spruce up the
- comments menu by appending an appropriate meta-character set to one or more of
- your comments - I don't know, maybe you want some comments to stand out more
- than others. Contained within 4Plus are nine 'ICON' resources with id's 257
- through 265... they may be used for meta-character sequences ^1 through ^9, and
- of course you can change them as you'd like (well, most of them... leave ID 257
- alone, I'm using it elsewhere).
-
- Here's an example.
-
- /* Items with icons */
- /* 4Plus^1 */
- /* You should know what this is^2 */
- /* THINK C Debugger^3 */
- /* THINK C Text File^4 */
- /* Lé Mac^5 */
- /* Jack in the Mac^6 */
- /* Talking in 1 pt Helvetica^7 */
- /* Road Sign^8 */
- /* I stole this from HyperCard^9 */
-
- /* Items with marks */
- /* Opt-shift K or Cntl T! */
- /* Cntl R! */
- /* Cntl S! */
- /* Opt 5!∞ */
-
- /* Items with style */
- /* Bold<B */
- /* Italic<I */
- /* Underline<U */
- /* Outline<O */
- /* Shadow<S */
-
- /* Ignored Keyboard equivalent/? */
-
- /* (Disabled */
-
- /* Notice that 4Plus won't allow; multiple items */
-
-
- The comment menu doesn't require anything of the window from within which it is
- invoked. Earlier on, I said that all of the 4Plus menus would not work with
- untitled windows. I lied. Also note that the previously stated reservations
- relating to the overuse of hierarchical menus applies here as well.
-
- /* The Omnibus */
-
- This menu is simply all of the above menus put into one. Well, not all of the
- menus... the normal methods menu won't appear, though it's counterpart the
- sorted methods menu will, and the headers menu is omitted as well - since it's
- really THINK C who's responsible for that. The benefit with using the omnibus
- menu is that you don't have to remember a bunch of modifier key/window
- partcode/planetary alignment combinations in order to get a 4Plus menu up on the
- screen. The downside with the omnibus menu is that 4Plus has to create ALL of
- the menus at once, and depending on your system and project size the delay may
- be unacceptable.
-
-
- /* Key Commands */
-
- There are two basic groups of key commands provided with 4Plus... key commands
- that actually do something THINK C previously couldn't, and key commands that
- let you reassign key sequences for things THINK C already knew how to do. The
- latter are provided primarily for those with non-ADB keyboards. Unless
- otherwise specified, all of the key commands will work with any text window,
- whether it has been saved or not. The flip side to that is that there has to be
- at least one text window open in order for any of the key commands to be
- recognized by 4Plus. Key commands, like 4Plus menus, can be reassigned to
- respond to different events. Additionally, 4Plus will recognize an assignment
- make from the keypad (i.e., you can assign a command to ctrl-'1' twice, one for
- the ctrl-'1' generated from the keyboard and one for the ctrl-'1' generated from
- the keypad). I'm going to describe the different commands in an order somewhat
- reflective of my ability to remember them all. Again, you'll need to refer to
- the dialog in order to determine how a given command is invoked.
-
- /* Configure */
-
- This assignment is the same thing as choosing Configure 4Plus… from the options
- menu. A convenience.
-
- /* Examine Assignment */
-
- Invoking this command makes 4Plus wait for a key event. When it gets one, it
- looks to see if there are any commands, macros, etc., which are assigned to the
- event. If there are, you'll get a dialog box displaying information appropriate
- to the assignment. For commands, this consists of nothing more than a short
- text description of what the command is supposed to do. For macros, you'll get
- a dialog that will allow you to view and edit both the macro's name as well as
- the key events which make it up. For searches, you'll get a dialog similar to
- THINK C's Find dialog. And finally for saved window positions, you'll get yet
- another dialog that will allow you to change the saved position.
-
- In the event there are no 4Plus assignments for a given key event, you'll just
- get a beep.
-
- /* Save Search */
-
- This allows you to save searches. After invoking this command, press whatever
- key you want a search to be assigned to. Whatever THINK C was set to search for
- has now been saved and can be performed by simply pressing the key you assigned
- the search to. Most all of what THINK C was set to search for is saved... the
- search string, the replace string, matching words, case sensitivity, wrap
- around, as well as whether it was a grep expression. The only settings that
- aren't saved are global search settings. Sorry.
-
- The usefulness of this feature should be obvious. It makes macros truly useful.
- And it's a great timesaver.
-
- Searches are displayed along with macros in the configuration dialog. Double
- clicking on a search assignment will open a dialog box in which you can edit the
- search... it's the same dialog you get from the ‘Examine Assignment’ command.
-
- /* Save Window Position */
-
- 4Plus allows you to save window positions. After invoking this command, press
- whatever key combination you want the frontmost window's position to be assigned
- to. The window position will then be assigned to this key event. Pressing the
- key you assigned the window position to will now position the frontmost window
- to the saved position. What I wanted to do was provide a mechanism with which I
- could press a key and have a source file and corresponding header file viewable
- at the same time, without having to play 'Mouse Wars'. So I defined a macro
- that repositions the frontmost window, opens (or selects) the windows
- corresponding header file (or source file if the window contained a header
- file), and repositions that window below the other.
-
- When you invoke the ‘Examine Assignment’ command on an assignment for a saved
- window position, you get a dialog that displays a miniature representation of
- the desktop, along with a scaled representation of a window in the saved
- position. You can move and resize the window from within the dialog, and the
- changes will be saved for the assignment.
-
- /* Enter Selection to Replace */
-
- This command behaves like THINK C's ‘Enter Selection’ command, only that the
- selection is entered as the replacement text instead of the search text. One
- difference between the two is that THINK C will switch out of Grep mode when you
- do an ‘Enter Selection’, whereas 4Plus doesn't bother.
-
- /* Match Words, Wrap Around, & Ignore Case */
-
- All these commands do is toggle the setting that previously was only toggleable
- from THINK C's Find dialog. The idea here is was to avoid having to make a trip
- to THINK C's Find dialog after doing a Enter Selection command just because one
- of these settings wasn't right. To be perfectly honest, I haven't found myself
- making a whole lot of use of it.
-
- /* Macro Record */
-
- This command delimits those keystrokes that are to be recorded as a macro. A
- macro can consist of any number of keystrokes, and may optionally invoke other
- macros, command key equivalents for the THINK C menus, or even macros defined
- from within other macro utilities (depending on your macro utility). The idea
- with the 4Plus macro utility is to make defining and invoking a macro as simple
- and as quick as possible. It isn't intended as a replacement for QuicKeys as
- the like, as the domain is pretty much restricted to text manipulation - and it
- is also important to recognize that I may be taking some liberties with the term
- “macro” - there is no facility for conditionals or argument substitution or any
- of that kind of stuff. The 4Plus macro utility works like this...
-
- Invoke the ‘Macro Record’ command. The cursor will change to a miniature
- version of the 4Plus ICON to let you know that macro recording is on. Type in
- whatever comes to mind. Invoke the ‘Macro Record’ command again. The cursor
- will resume a normal appearance letting you know that macro recording is off.
- Now press whatever key you want the macro to be assigned to. The function keys
- on the extended ADB keyboard are good for this, but any modifier key/normal key
- combination will do.
-
- We now have a working macro. You invoke it by pressing the key combination you
- assigned to it. The macro will be saved and will be available for use in
- subsequent sessions.
-
- If you invoke the ‘Macro Record’ command twice, the next key combination you
- enter will be deassigned if it was previously assigned to a macro (or a search,
- or a window position). If it wasn't previously assigned nothing will happen.
- If you invoke ‘Macro Record’ twice while recording a macro, the recording will
- be aborted and no assignment will be made.
-
- A macro key assignment will override a THINK C menu's command key equivalent and
- a 4Plus key command, but not another macro utilities key assignment (depending
- on the macro utility).
-
- As I mentioned, a macro can itself invoke another macro. The limit on macro
- nesting is set at 16. A limit is necessary, as the following scenario will
- demonstrate.
-
- Say you define the F5 key to play back the characters 'bar'. Then you define
- the F6 key to play back the characters 'Foo', followed by the F5 key. So now
- when you invoke the F6 key, you get 'Foobar'. Now you redefine the F5 key to
- play back the characters 'bar', followed by the F6 key. Hmmm. Invoking the F6
- key plays back the characters 'Foo', and invokes the F5 key, which plays back
- the characters 'bar', and invokes the F6 key, which plays back the characters
- 'Foo', and invokes the F5 key, which plays back the characters 'bar', and
- invokes the F6 key, which plays back the characters 'Foo', and invokes the F5
- key, and so on. Without a nesting limit, this would continue until we either
- ran out of memory or out of patience.
-
- Anyhow, whenever a macro is running you can always abort it by doing a command
- period. In fact, any time you're running a macro you should be poised to do a
- command period as sometimes macros can do things you weren't interested in
- having them do. Testing the macro utility was a lot of fun.
-
- Certain commands will automatically abort a macro. For instance, any cursor key
- operation that should change the selection range but doesn't will abort a macro.
- Any error condition detected by 4Plus will abort a macro. Other 4Plus commands
- will abort a macro in situations peculiar to themselves... they are listed where
- appropriate in the commands description.
-
- Macros can be reassigned to different keys just like commands. Call up the
- configuration dialog and select the radio button titled ‘Macros’. A list of all
- macro assignments will be generated, as well as search assignments and window
- positions. Each assignment may optionally have a name associated with it if it
- should be that you've assigned one to it. Select one and you can enter a new
- assignment. Double click on one and you get a dialog box from within which you
- can edit the macro, as well as enter a name for it. This is the same dialog
- that you get when you do an ‘Examine Assignment’.
-
- /* Repeat */
-
- Closely related to the macro facility is the “Repeat” command, which is provided
- for those instances where you want a given key sequence to be repeated over and
- over again. Though ‘Repeat’ is generally used with 4Plus macros, it can be used
- with THINK C command key equivalents as well. All you do is invoke the ‘Repeat’
- command and then enter a key combination you want to have repeated. And it is.
- Over and over. Relentlessly. Until you either do a command period, or, in the
- case of some of the 4Plus key commands to be described later, the repeated
- command cannot be performed.
-
- So in the preceding example on macro nesting, it looks like what we wanted to
- have happen was for the word 'Foobar' to continuously repeat itself. An
- interesting coding style, to be sure. I think we can all agree that the proper
- way to do this would be to set up a macro to play back the characters 'Foobar',
- invoke the ‘Repeat’ command, and then invoke the macro.
-
- FoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobarFoobar
-
- A note on the ‘Repeat’ command. If used before invoking a macro, issuing a
- command period will abort the repeat process, however, the macro being repeated
- will be allowed to finish it's playback. This is a feature. If you want to
- abort both, issue the command period sequence twice. It is possible to record
- the ‘Repeat’ command within a macro, and for that macro itself to have been
- repeated from within yet another macro which was itself invoked after invoking
- the ‘Repeat’ command. In such an instance, it may be necessary to issue a whole
- bunch of command periods if you want the thing to stop.
-
- /* Marks */
-
- A mark, in 4Plus, is a position within a file. A mark contains information that
- associates it with a window, and with a selection range within that window.
- 4Plus allows you to save and restore marks, and it allows you to do so with some
- flexibility. This is useful in instances where you are working on many parts of
- a project or a file simultaneously and you want to be able to goto these
- different parts quickly and with a minimum of fuss. A mark survives only as
- long as the window to which it is associated remains open... once you close the
- window, the mark is deallocated. Additionally, if you revert a file to the last
- saved version any marks associated with the file are deallocated as well. A
- mark is also removed when the text associated with the mark is deleted or
- replaced.
-
- /* The Mark Keys */
-
- The most basic mark mechanism allows you to assign individual marks to
- individual keys. The ‘Assign Mark’ command will prompt you for an individual
- key (as opposed to a modifier key combination). The key you then enter will be
- assigned to the current window and selection range. Invoking the ‘Goto Mark’
- command followed by the assigned key will then select that window (in the case
- where it is not frontmost when the command was invoked), restore the selection
- range, and then scroll the window so that the selection range is visible.
- Assigning a mark to a key that already has a mark will replace the old mark with
- the new one.
-
- /* The Mark Queue */
-
- The mark queue is a queue consisting of one or more marks. When using the queue
- there is always a current mark... it may either be the last mark entered or the
- last mark accessed. New marks are always entered into the queue following the
- current mark.
-
- The ‘Mark Position’ command enters the current window and selection range into
- the mark queue. If the queue already contains one or more marks, the mark is
- entered after the current mark, otherwise it becomes the first mark in the
- queue. In either case, the mark becomes the current mark.
-
- The ‘Previous Mark’ command will do one of two things. If the current selection
- range/and or frontmost window is different from that stored as the current mark,
- the current mark will be displayed, otherwise the mark preceding the current
- mark in the mark queue becomes the current mark and it is displayed. ‘Next
- Mark’ displays the mark inserted after the current mark, which then becomes the
- current mark. Again, for both commands, if the window in which the new current
- mark is set is not the foremost window, it is selected, and if the marked
- position is not visible in the window, the window is scrolled so as to display
- the mark. The selection range is then restored to what it was when the mark was
- entered into the queue. If the current mark is deleted, the previous mark
- becomes the current mark, unless there is no previous mark, in which case the
- next mark becomes the current mark.
-
- /* The Mark Stack */
-
- If the mark queue sounds a little convoluted, there's something called the mark
- stack that can be used instead. The name should say it all, but I'll try to
- explain it anyway. The mark stack is a stack of marks, and the current mark is
- always the last mark entered on the stack. ‘Push Mark’ 'pushes' a mark on to
- the mark stack. This mark becomes the current mark, and may be accessed via the
- ‘Pop Mark’ command. Once you do a ‘Pop Mark’, the popped mark is deallocated
- and is no longer available. The mark stack is most useful when used in macros,
- due to their transitory nature.
-
- You'll probably need to play with the mark queue and the mark stack a little to
- better understand what I'm talking about. The idea is that you can mark the
- position in a text window in which you are currently working, scroll to another
- part of the document or open or select another document, make whatever changes
- you want, and quickly pick up where you left off by displaying the current mark.
- For large documents or for those heavy duty editing sessions, you can arrange
- virtually any number of marks spanning multiple documents and go from mark to
- mark with a key press. Marks entered via the mark queue, mark stack and mark
- keys mechanisms are all independent of one another, that is, you can intersperse
- marks throughout a project using any or all of the above methods without
- affecting the status of any of the others.
-
- To dispose of all of the marks assigned via the ‘Mark Keys’ mechanism, select
- ‘Trash Mark Keys’ from the options menu. ‘Trash Mark Queue’ does the same thing
- for the mark queue, and ‘Trash Mark Stack’ likewise for the mark stack. Again,
- it is important to note that all marks for a window are removed when the window
- is closed, or when you choose Revert from THINK C's File menu for a window. A
- mark is also removed when the text associated with the mark is deleted or
- replaced. If you attempt to select a mark using any of the above commands, and
- there is no such mark to go to, 4Plus will emit a beep, and if the command was
- invoked by a macro and there is no mark to go to, the macro playback is aborted.
-
- /* The Scrap Stack */
-
- The ‘Stack Cut’, ‘Stack Copy’, ‘Stack Paste’ and ‘Stack Flush’ commands all deal
- with something called the scrap stack. The name should pretty much say it all.
- The scrap stack complements the normal scrap - the cut, copy and paste commands
- as implemented by THINK C still do exactly what they did before. When you do a
- ‘Stack Cut’ or ‘Stack Copy’, the contents of THINK C's scrap are copied to the
- stack scrap, and then the cut or copy is performed normally. When you do a
- ‘Stack Paste’, the scrap is pasted into the document, and the last entry in the
- stack scrap then replaces THINK C's scrap. There is no predefined limit as to
- how many entries may exist within the stack, available memory is the only
- constraining factor. The ‘Stack Flush’ command will take all of the entries in
- the scrap stack, concatenate them, place the result in THINK C's scrap, and
- perform a paste with the new contents of the scrap. The scrap stack is then
- deleted.
-
- If you invoke the ‘Stack Paste’ or ‘Stack Flush’ commands when the scrap stack
- is empty, 4Plus will emit a beep, and if these commands were invoked via
- playback of a macro the playback is aborted.
-
- A little common sense is in order when using the scrap stack. You shouldn't use
- it for storing multiple selections of an unusually large size. The code in
- 4Plus is sensitive to memory use and won't do anything stupid if a stack
- operation can't be performed due to lack of memory, but it's not the purpose of
- the scrap stack to be used in this manner. If you want to deallocate the scrap
- stack for any reason, choose ‘Trash Scrap Stack’ from the options menu. Note
- that for use in macros, a ‘Trash Scrap Stack’ key command is provided as well.
- Neither will affect the normal scrap. Also note that the scrap mechanism used
- by THINK C limits the size of the scrap to 32K... so each entry in the scrap
- stack is limited to the same size. The total size of all entries in the scrap
- stack can exceed 32K of course, but then you'll get undefined results when
- performing a ‘Stack Flush’.
-
- /* Scrap Swapping */
-
- Related to the scrap stack is the ‘Scrap Swap’ key command. A ‘Scrap Swap’
- merely exchanges the contents of the scrap with the current selection in the
- foremost text window - the selected text is copied into a separate buffer, the
- scrap replaces the selected text, and the text in the separate buffer replaces
- the scrap.
-
- /* UPPER And lower Case */
-
- The ‘Upper Case’ command coerces all selected lower case text to be upper case.
- Vice versa for the ‘Lower Case’ command.
-
- /* Opening Headers */
-
- The ‘Open Header/Source’ command does exactly that. It takes the name of the
- frontmost document and determines if it is a source file or a header file (*.c
- vs. *.h). For source files, it looks for a header file with the same name and
- opens it (foo.c opens foo.h). Vice versa for header files. This is good for
- macros.
-
- /* Token Selection */
-
- The ‘Token Left’, ‘Token Right’, ‘Select Left Token’ and ‘Select Right Token’
- key commands all operate on tokens in the same way the left and right arrow keys
- operate on characters. There are three types of tokens - those character
- sequences made up of those characters allowed in C variable names, white space
- characters, and everything else. Note that this is similar to effect achieved
- by double clicking on a token, though only C variable type names can be selected
- this way. The primary intent for providing these commands is for their use in
- macros, as such functionality is virtually mandatory in order for the macro
- facility to be a useful tool.
-
- Additionally, there is a ‘Next Token’ and a ‘Previous Token’ command. These are
- similar to the above, save that only those characters belonging to a token are
- selected. Play around with it, I'm not sure I can explain it right.
-
- /* Method Selection */
-
- The last two commands of substance are the ‘Next Method’ and ‘Previous Method’
- commands. When invoked, they both take note of the currently selected method
- (the method that contains the insertion point or the beginning of an extended
- selection). ‘Next Method’ will scroll the window to display the next method
- declared in the file and will hilight the method's name, ‘Previous Method’ will
- display the previous method as declared in the file in much the same fashion.
- If either command is invoked and there is no next or previous method 4Plus will
- emit a beep, and if these commands were invoked via playback of a macro and no
- next or previous method exists, the playback is aborted.
-
- ‘Next Method’ and ‘Previous Method’ both make use of the same code to parse a
- source file as the methods menu, as such, the limitations described above for
- the method menu apply with these commands as well. Additionally, the text
- window in which either command is invoked must be a source file and be
- appropriately named (*.c).
-
- /* Comment Selection */
-
- Selects the comment containing the current selection range if such a comment
- exists, otherwise it beeps. Kind of like THINK C's “Balance” command.
-
- /* More Key Commands<I */
-
- The remaining key commands don't really do anything you couldn't do before with
- THINK C and can be divided into two groups, those that fill minor gaps in THINK
- C's treatment of the extended ADB keyboard, and those that allow owners of non-
- ADB keyboards without arrow keys access to arrow key functionality.
-
- /* Home */
-
- The ‘Home’ key command does what the Home key should do, it scrolls the current
- document to it's 'home' position, without affecting the insertion point or
- current selection range. It is functionally equivalent to dragging the thumbs
- on both scroll bars to the scroll bar's minimum setting.
-
- /* End */
-
- The ‘End’ key command does what the End key should do, it scrolls the current
- document to it's 'end' position, without affecting the insertion point or
- current selection range. It is functionally equivalent to dragging the thumb on
- the vertical scroll bar to it's maximum setting.
-
- /* Page Up */
-
- The ‘Page Up’ key command is the equivalent of clicking in the pageUp portion of
- the vertical scroll bar.
-
- /* Page Down */
-
- The ‘Page Down’ key command is the equivalent of clicking in the pageDown
- portion of the vertical scroll bar.
-
- /* Scroll Up */
-
- The ‘Scroll Up’ key command is the equivalent of clicking in the inUpArrow
- portion of the vertical scroll bar.
-
- /* Scroll Down */
-
- The ‘Scroll Down’ key command is the equivalent of clicking in the inDownArrow
- portion of the vertical scroll bar.
-
- /* Forward Delete */
-
- The ‘Forward Delete’ key command does a forward delete. The character to the
- right of the insertion point is deleted. The ‘Forward Delete’ command works
- exactly like a normal delete in the case of a selection spanning one or more
- characters.
-
- /* Still More Key Commands */
-
- The remaining key commands all duplicate THINK C's treatment of the arrow keys,
- and are provided mainly for the benefit of those without arrow keys on their
- keyboards. The default assignments for these commands are essentially what the
- assignments are within THINK C. Users with arrow keys can deassign them if
- desired, though you're not going to gain anything by doing so. One possible use
- might be to remap the option modified arrow key assignments to be invoked with
- the command key instead, and use the option key in conjunction with the arrow
- keys to perform the ‘Left Token’, ‘Right Token’, ‘Next Method’, and ‘Previous
- Method’ commands. This would bring the use of modified arrow keys in accordance
- with the user interface guidelines as Apple has stated them. I'm probably
- reaching here, but that's the only use I can think of for ADB owners to use
- these assignments.
-
- /* Other Options */
-
- /* Update “rsrc.h” */
-
- ‘Update "rsrc.h"’ may be of dubious utility, depending on how you deal with
- resources in development. When selected, 4Plus will attempt to locate the
- project's resource file (the file whose name is that of the project's with
- '.rsrc' appended to it). If it finds such a resource file, it will then create
- a text file called "rsrc.h". Then it will scan through the resource file, type
- by type, looking for all of the contained resources. For each type, an enum
- statement listing all resources belonging to that type will be added to the text
- file. If a resource has a name, that name will be used in the enumerator,
- otherwise 4Plus will name it _UNTITLED_n_, where n is the number of occurrences
- of such untitled resources up to that point. The value assigned to the
- enumerator will be the resource's id, and a comment will be appended to the
- statement indicating which attributes have been set for the resource. If the
- file "rsrc.h" is open in it's own window, the window will be selected and 4Plus
- will issue a Revert command to THINK C so as to update the contents of the
- window to reflect the contents of the file.
-
- The idea here is to allow you to create resources on the fly using ResEdit, name
- them using ResEdit, and update your code's references to the resources with a
- single menu selection. Of course, the names you give to the resources should be
- valid in C - no spaces, pound signs and the like.
-
- A feature/bug with the ‘Update "rsrc.h"’ command has to do with THINK C not
- knowing that the file has been changed. This can be good, and this can be bad.
- It's good if all you're doing is adding a new resource - typically the only code
- that will need to be recompiled will be those files which refer to the resource,
- and those files are already marked to be recompiled by virtue of your having
- made the changes in them that deal with the resource. If you're used to keeping
- all your equates that deal with resources in one file, and you deal in big
- projects, this is a good thing as it saves you from either rebuilding your
- entire project or manually deselecting those files that don't need to be
- recompiled.
-
- It's not so good though in the situation wherein you change either the id or the
- name for a resource. Here, you may have some files that really do need to be
- advised of the change relating to the resource, and of course, as THINK C
- doesn't know about the change in "rsrc.h", the chances are that the project will
- be out of date. In this case, you'll need to manually advise THINK C of the
- change to the file, and that'll entail a trip to the Make dialog.
-
- ‘Update “rsrc.h”’ will open the project's resource file read only, so it will
- not complain if the resource file is already open from some other application,
- like ResEdit. However, this doesn't mean that the results obtained when
- performing ‘Update “rsrc.h”’ are necessarily valid in this case... if you made
- any name or ID changes in ResEdit and they haven't been saved, you and 4Plus
- will very likely not get wind of them.
-
- You can change the specification for "rsrc.h" by observing that 'STR ' resource
- id 128 in the 4Plus file contains the string used as the file specification. If
- 4Plus finds a ':' character within this string it will substitute the project
- name for the colon, though this is probably not a good idea if you've taken to
- naming your projects with a '.π' suffix. 4Plus sticks a #define _H_rsrc
- directive in rsrc.h - if it's #define _H_proj.π, THINK C will think you're
- defining _H_proj to be '.π', and in the case where you have some other header
- that's named 'proj.h' that might not be a good thing. You don't need/want to
- include a '.h' in the string, 4Plus will do that automatically. You can disable
- this feature altogether by simply deleting the resource. I know that that will
- be the preference for some.
-
- /* Update “proj.π.rsrc” */
-
- This command works in conjunction with the previous command, ‘Update “rsrc.h”’.
- ‘Update “proj.π.rsrc”’ is only active when the frontmost window has the same
- name as rsrc.h (or whatever file specification you've assigned). It will
- reflect any changes you make in rsrc.h to proj.π.rsrc, which will be your
- project resource file. The idea here is to create a header file listing all of
- your resources using ‘Update “rsrc.h”’, change any of the names, ID's, or
- attributes for those resources using THINK C's text editor, and then use ‘Update
- “proj.π.rsrc”’ to incorporate those changes back into the project's resource
- file.
-
- When you perform a ‘Update “rsrc.h”’, 4Plus stores some information in the
- header file's resource fork relating to the resources contained in the project
- resource file. This information is basically a list of all of the resource
- types contained in the project resource file, and for each type, a list of all
- resources with that type - it serves as a binary mirror of the information
- contained in the text file. When doing a ‘Update “proj.π.rsrc”’, 4Plus will use
- this information to determine whether any significant changes have been made to
- the project's resource file since it was last parsed by 4Plus. A significant
- change as far as 4Plus is concerned is one that affects the addition or deletion
- of a resource, or the change of a resource's id. If no such changes are found,
- 4Plus will then compare the number of types and the number of resources for each
- type in the project resource file with the number of types and the number of
- resources declared for each type in the text file. If there are still no
- discrepancies, 4Plus will then begin it's final pass over rsrc.h, obtaining each
- resource in the project resource file associated with each enumerator, and
- making any necessary changes to the resource's name, id, or attributes so as to
- make the project resource file reflect rsrc.h. If any errors are encountered
- during this process, 4Plus calls the show off and instructs the Resource Manager
- to ignore any changes made to the project's resource file up to that point, thus
- rendering the resource file unchanged.
-
- There are a few things to keep in mind when using this command. First and
- foremost, MAKE A BACKUP OF YOUR PROJECT'S RESOURCE FILE BEFORE SUBJECTING IT TO
- 4PLUS! Minor name changes and simple attribute twiddling is best performed from
- within ResEdit - I intended this feature only to be used in those instances
- where major resource map modifications were needed.
-
- Secondly, know that 4Plus is reading those comments it inserts in the header
- file when you do a ‘Update “rsrc.h”’. The resource types and the resource
- attributes are all detailed via comments so that the header file won't get
- barfed on by the compiler. Of course, you'll be wanting to change the attribute
- comments every so often, but leave the type comments alone. 4Plus ignores white
- space in it's parse, but it fully expects the resource type to be delimited by
- single quotes. The format for the attribute comments is considerably more
- relaxed, 4Plus is just looking for strings like resPurgeable, resPreload, etc.
- It doesn't care what surrounds it.
-
- Third, don't change the order in which the resources are listed within a enum
- statement. You can change the order in which the statements (types) themselves
- occur (why?), but don't reverse or reorder the individual enumerators unless
- that is what you really want to do. It's OK to swap the id's on two or more
- resources within a type, as 4Plus references each resource based on the order in
- which they occur both in the resource file's reference map as well as within the
- text file itself.
-
- Here's an example that I hope will make everything clear.
-
- This is how a portion of rsrc.h looks right after we perform an ‘Update
- “rsrc.h”’...
-
- /* 'DLOG' */
-
- enum {
- DAFFY_DLOG_ID = 128, /* resPurgeable */
- GOOFY_DLOG_ID, /* resPurgeable */
- DOPEY_DLOG_ID,
- _UNTITLED_1_ /* resSysHeap */
- };
-
- This is how that very same portion would look after some simple changes...
-
- /* 'DLOG' */
-
- enum {
- DAFFY_DLOG_ID = 128, /* resPurgeable */
- WIMPY_DLOG_ID, /* resPurgeable */
- DOPEY_DLOG_ID = 131, /* resPurgeable */
- _UNTITLED_1_ /* resPurgeable */
- };
-
- Note that we have changed the name of 'DLOG' #129 to WIMPY_DLOG_ID, and that all
- of the resources have been marked as purgeable. Note also that by adding the
- explicit enumerator assignment of 131 for DOPEY_DLOG_ID, we have effectively
- renumbered both that and the next resource to 131 and 132, respectively. 4Plus
- will handle instances where a newly assigned resource ID conflicts with an
- already assigned ID - in this case 4Plus renumbered _UNTITLED_1_ before
- DOPEY_DLOG_ID so as to free up the id slot. Note that 4Plus will not touch the
- name for a resource if the enumerator token is _UNTITLED_n_.
-
- 4Plus performs a very limited parse on the resource header file. It will
- correctly handle the enum statements, and it will correct handle the comments.
- Everything/anything else that you might throw in there 4Plus will ignore. One
- thing that you might be tempted to do is to set up yet another header file which
- is to be included within the resource header file and which contains a set of
- base id #defines to be used with the enum statements. 4Plus won't let you do
- that. But maybe soon.
-
- /* Color Hilighting */
-
- The next option to be touched on is the ‘Color Hilighting’ option. This is very
- simple, it simply provides users of color monitors the ability to substitute the
- default hilight color for the plain inversion THINK C performs when selecting
- text.
-
- /* The Power Thumb */
-
- The next option is the ‘Power Thumb’. I like this one, and it should be a hit
- with users of large screens and fast CPU's. The ‘Power Thumb’ actually scrolls
- the document while you drag on the thumb (the thumb is sometimes referred to as
- the elevator box I guess, it's the little box inside a scroll bar that goes up
- and down). No grey outlines, no guessing where you should release the thumb,
- just grab it and watch the text fly by. Depressing the option key while you use
- the thumb causes it to behave as usual. Deselecting the option reverses it,
- that is, the thumb behaves normally unless you use it with the option key
- depressed, then you get the ‘Power Thumb’ effect.
-
- /* Prompt Keystroke */
-
- This last option just lets you control whether or not you get a little window
- displayed prompting you to enter a keystroke for those commands that expect one
- (i.e. macro assignment, examining assignments, saving searches, etc.)
-
- /* Grep Menus */
-
- Within THINK C's Find dialog box are two popup menus that are active only when
- the grep option is turned on. One menu for search strings, one for replace
- strings. Every time you enter a search or replace string in GREP mode, the
- string is added to the menu. Choosing a string from the menu enters that string
- as the string to be searched on or replaced. The menus are sorted according to
- the frequency with which the string is used, and are saved and restored at
- application exit/launch. Especially handy with those hard to remember GREP
- strings. To delete an item in one of the menus, option-click select it.
-
- /* Version Territory */
-
- 4Plus will allow you to create, modify or delete 'vers' resources contained in
- your project's resource file. Choosing the item “Version Territory” will
- present you with a dialog in which any necessary changes can be made. It is
- assumed that you know what a 'vers' resource is. The four controls at the top
- of the dialog allow you to change the version number, the two popup menus let
- you change the stage and country fields of the resource, and the editText item
- allows you to enter the message. Note that the editText item is exactly the
- same size as the statText field the Finder uses to display the message for
- 'vers' 1 resources, and that 4Plus uses the same font as the Finder. The
- version string is displayed in a statText item... it reflects any of the changes
- to the version number made using the controls or stage menu and cannot be
- directly edited (though if you click on it, the version number will replace the
- text selected within the message editText field). The two control pairs at the
- top right of the dialog allow you to add or delete 'vers' resources 1 or 2, and
- to choose which of the two are to be edited.
-
- The check box labeled “autoBump” controls whether 4Plus will increment the
- version number contained in 'vers' ID 1 every time you do a “Build
- Application/Code Resource/etc.”. If checked, 4Plus will detect when you are
- actually about to build your application. When you do, 4Plus will load in the
- 'vers' resource, add 1 to the nonRelRev field and update both the version and
- message strings so as to reflect the new version number. The version string is
- simply created from scratch - the message string is treated differently. 4Plus
- will look for an instance of the old version string within the message string,
- and if it finds such an instance it will replace the old string with the new
- version string (a la Munger). Note that the string to be replaced needs to be
- exactly identical to the old version string.
-
- 4Plus detects a application/code resource/etc. build when the SFPPutFile dialog
- box for building applications/code resources/etc. is displayed. So the version
- number doesn't get bumped in those instances where a build couldn't be completed
- due to problems with your code. However, it does mean that the version number
- will get bumped regardless of what you do with the SFPPutFile dialog...
- cancelling the build by clicking the Cancel button won't make any difference -
- you'll still get bumped.
-
-
- /* About This INIT <I */
-
- Before I wrap it up, some notes about 4Plus, the INIT. It basically consists of
- two portions, a little nub that hangs out in the system heap and the main code
- that resides within THINK C's heap. The nub takes up about 1K. It's job is
- just to sense when THINK C has been launched. When it is, it loads the main
- code into THINK C's heap, moves it to the top of the heap, and locks it. The
- main code is a little under 30K in size. Other code, such as for the
- configuration dialog, or for the ‘About 4Plus…’ item, are loaded as needed and
- discarded when no longer needed.
-
- There are three benefits to this approach. First, you're not wasting any space
- in the system heap when 4Plus is installed and you're not using THINK C.
- Secondly, it should be obvious that I've patched a few traps to get this thing
- to run. The vast majority of these patches are made within THINK C's heap,
- thus, when running under MultiFinder, the patches are swapped out with a context
- switch thereby ensuring that 4Plus won't muck up any other applications (in
- theory). And lastly, because the patches are made when THINK C is launched,
- 4Plus gets the first shot at intercepting the relevant trap calls, thus ensuring
- compatibility with the various other INIT's, cdev's and the like. Or, at least
- that's the way it should be.
-
- Because 4Plus allocates memory in THINK C's heap, it might be a good idea to
- bump up THINK C's partition size a bit. This depends on your project size, most
- users probably shouldn't be concerned. THINK C does a good job with memory
- management and will let you know if things are getting hairy.
-
- Users of anti-viral programs released as INIT's and cdev's may have to take
- steps to accommodate 4Plus... if you have the option to specify privileges for
- programs on a program by program basis, do so for 4Plus. Otherwise just rename
- 4Plus so that it loads before the anti-viral program.
-
- 4Plus looks for a THINK C launch by looking at the name of each launched
- application. Yes, I know there are other, more elegant ways of doing this, but
- they were causing problems with the source code debugger, and besides, they take
- up more CPU time/resources. As it is now, THINK C should be called THINK C.
- If, for some bizarre reason, THINK C is not called THINK C on your system, then
- you can observe that 4Plus looks at the 'STR ' #129 resource to determine what
- the name for THINK C is.
-
-
- /* PLEASE SUPPORT SHAREWARE<B<O */
-
- Registration entails that you send me a check or money order for $40. Site
- licenses can be had for a paltry $110. If you're not in the United States and
- you want me to send you a disk, please add an additional amount so as to cover
- shipping expenses... I'd tell you how much if I knew where you are.
-
- You'll want to make the check or money order payable to Donald Way.
-
- You'll want to send the check or money order to...
-
- Donald Way
- 109 4th Street
- Hoboken, NJ 07030
-
-
-
- THINK C is a trademark of Symantec and is easily the best development system
- available.
-
- And getting better all the time :)
-